package com.example.demo.service.configfile;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.mapper.ConfigFileMapper;
import com.example.demo.pojo.ConfigFile;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhangguihong
 * @since 2024-12-27
 */
@Service
public class ConfigFileServiceImpl extends ServiceImpl<ConfigFileMapper, ConfigFile> implements IConfigFileService {


    @Override
    public ConfigFile fingCofigFileByKey() {
        LambdaQueryWrapper<ConfigFile> lambdaQueryWrapper=new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(ConfigFile::getKeyMain,1);
        ConfigFile configFile = this.getOne(lambdaQueryWrapper);
        return configFile;
    }

    @Override
    public String fingCofigFilePath(Integer id) {
        ConfigFile configFile = this.getById(id);
        if(configFile==null){
            return null;
        }
        return configFile.getFilePath();
    }
}
